/* **********************************************************
 * Copyright 2010 Dimitar Vangelovski
 *
 * This file is part of the Gens3 3D Engine.
 * 
 * The Gens3 3D Engine is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 * 
 * The Gens3 3D Engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with the Gens3 3D Engine; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA
 * **********************************************************/


#pragma once

#include "Vertex.h"
#include "MeshFace.h"
#include "MeshFaceNormal.h"
#include <vector>

class CMeshTVertList;
class CMeshTFaceList;

class CMesh
{
public:

	CMesh();
	CMesh(const CMesh &other);
	CMesh(int nMeshNumVertex, int nMeshNumFaces);
	~CMesh();

	void	SetMeshTVertList(CMeshTVertList * pMeshTVertList) { m_pMeshTVertList = pMeshTVertList; }
	void	SetMeshTFaceList(CMeshTFaceList * pMeshTFaceList) { m_pMeshTFaceList = pMeshTFaceList;	}
	void	SetVertex(int nPos, const CVertex &other) { m_MeshVertexList[nPos] = other; }
	void	SetVertexList(const std::vector<CVertex> &other) { m_MeshVertexList = other; }
	void	SetMeshFace(int nPos, const CMeshFace &other) { m_MeshFaceList[nPos] = other; }
	void	SetMeshFaceList(const std::vector<CMeshFace> &other) { m_MeshFaceList = other; }
	void	SetFaceNormal(int nPos, const CMeshFaceNormal &other) { m_MeshNormals[nPos] = other; }
	void	SetMeshNormals(const std::vector<CMeshFaceNormal> &other) { m_MeshNormals = other; }
	void	SetMeshNumVertex(int iValue) { m_nMeshNumVertex = iValue; }
	void	SetMeshNumFaces(int iValue) { m_nMeshNumFaces = iValue; }

	void	InsertVertex(const CVertex &other) { m_MeshVertexList.push_back(other); }
	void	InsertMeshFace(const CMeshFace &other) { m_MeshFaceList.push_back(other); }
	void	InsertFaceNormal(const CMeshFaceNormal &other) { m_MeshNormals.push_back(other); }

	std::vector<CVertex> 		GetMeshVertexList() const { return m_MeshVertexList; }
	std::vector<CMeshFace> 		GetMeshFaceList() const { return m_MeshFaceList; }
	std::vector<CMeshFaceNormal> 	GetMeshNormals() const { return m_MeshNormals; }
	CMeshTVertList *		GetMeshTVertList() const { return m_pMeshTVertList; }
	CMeshTFaceList *		GetMeshTFaceList() const { return m_pMeshTFaceList; }
	CVertex				GetVertex(int nPos) const { return m_MeshVertexList[nPos]; }
	CMeshFace			GetMeshFace(int nPos) const { return m_MeshFaceList[nPos]; }
	CMeshFaceNormal			GetFaceNormal(int nPos) const { return m_MeshNormals[nPos]; }
	int				GetMeshNumVertex() const { return m_nMeshNumVertex; }
	int				GetMeshNumFaces() const { return m_nMeshNumFaces; }

private:
	std::vector<CVertex>		m_MeshVertexList;
	std::vector<CMeshFace>		m_MeshFaceList;
	std::vector<CMeshFaceNormal>	m_MeshNormals;
	CMeshTVertList *		m_pMeshTVertList;
	CMeshTFaceList *		m_pMeshTFaceList;
	int				m_nMeshNumVertex;
	int				m_nMeshNumFaces;
};

